<?php

class DotestController extends Controller
{
	/**
	 * Declares class-based actions.
	 */
	public function actions() {
		return array(
		);
	}

    public function  actionAddTask($oid) {
        echoToMobile(DubaiService::addOrderMonitorTask($oid));
    }
    public function  actionCancelTask($oid) {
        echoToMobile(DubaiService::cancelOrderMonitorTask($oid));
    }

    public function actionPaidOrder() {
        $post_data = array();
        $post_data['orderid'] = "532c49ff0293450d040041ad";
        $post_data['addressid'] = "532c58300293450e040041b3";
        $post_data['grade'] = 1;
        $url='http://127.0.0.1/yii/dubai/index.php/order/paidOrder';
        $o="";

        foreach ($post_data as $k=>$v)
        {
            $o.= "$k=".urlencode($v)."&";
        }

        $post_data=substr($o,0,-1);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        $result = curl_exec($ch);

    }

    public function actionAddAddress() {
        $post_data = array();
        $post_data['address'] = "大 家一起去打架";
        $post_data['consignee'] ="物流";
        $post_data['mobile'] = "大家一起去打架";
        $post_data['telephone'] ="123342234234";
        $post_data['email'] ="wliu@3ti.us";

        $url='http://127.0.0.1/dubai/index.php/personalCenter/addAddress';
        $o="";

        foreach ($post_data as $k=>$v)
        {
            $o.= "$k=".urlencode($v)."&";
        }

        $post_data=substr($o,0,-1);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        $result = curl_exec($ch);
    }


    public function actionAddcomment() {
        $post_data = array();
        $post_data['gid'] = "5309b0bc2e2f940cec0041a9";
        $post_data['content'] = "你的商品真差劲";
        $post_data['grade'] = 3;
        $url='http://127.0.0.1/yii/dubai/index.php/goods/addGoodsComment';
        $o="";
        foreach ($post_data as $k=>$v)
        {
            $o.= "$k=".urlencode($v)."&";
        }

        $post_data=substr($o,0,-1);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        $result = curl_exec($ch);

    }
}